{ Statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=3055
  Verdict: Accepted
}
uses
	SysUtils, Math;
 
var
	i, n : longint;
 
procedure ch(x, y : longint);
begin
	writeln('0 ', x, ' ', y);
end;
 
procedure mv(t, n : longint);
begin
	if n < 1 then exit;
	if t = 1 then begin
		if n = 1 then begin
			writeln('1 2 1');
			exit;
		end;
		mv(1, n - 1);
		mv(3, n - 2);
		ch(1, 2);
		mv(2, n - 2);
		mv(1, n - 1);
	end else
	if t = 2 then begin
		if n = 1 then begin
			writeln('1 3 2');
			exit;
		end;
		mv(2, n - 1);
		mv(1, n - 2);
		ch(2, 3);
		mv(3, n - 2);
		mv(2, n - 1);
	end else
	if t = 3 then begin
		if n = 1 then begin
			writeln('1 1 3');
			exit;
		end;
		mv(3, n - 1);
		mv(2, n - 2);
		ch(1, 3);
		mv(1, n - 2);
		mv(3, n - 1);
	end;
end;
 
procedure get(n : longint);
begin
	mv(2, n - 2);
	ch(1, 3);
	mv(1, n - 2);
	mv(3, n - 1);
end;
 
begin
	reset(input,'input.txt');
	rewrite(output,'output.txt');
	read(n);
	writeln('1 1 3');
	if n = 1 then halt(0);
	writeln('0 1 3');
	writeln('1 1 3');
	if n = 2 then halt(0);
	for i := 3 to n do begin
		get(i);
	end;
end.